/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.tkgarment.system.dao;

import com.tkgarment.system.domain.EmpStatus;
import com.tkgarment.system.factory.DAOFactory;
import com.tkgarment.system.inf.IDAO;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 *
 * @author zraj
 */
public class EmpStatusDAO extends AbstractDAO implements IDAO<EmpStatus, Integer> {

    @Override
    public List<EmpStatus> getAll() throws Exception {
        String sql = "select * from emp_status order by "+  EmpStatus.field_status_name +" ASC ";
        if (this.getCon() == null) {
            this.setCon(DAOFactory.creatConnection());
        }
        List<Map<String, Object>> result = this.getCon().queryList(sql);
        List<EmpStatus> empStatus  = new ArrayList<>();
        for (Map<String, Object> map : result) {
            EmpStatus es = new EmpStatus();
            es.setStatusId(Integer.parseInt(map.get(EmpStatus.field_statusid).toString()));
            es.setStatusName(map.get(EmpStatus.field_status_name).toString());
            empStatus.add(es);
        }
        return empStatus;
    }

    @Override
    public int updateSingle(EmpStatus t, Integer id) throws Exception {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public int deleteSingle(EmpStatus t) throws Exception {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public int insertSingle(EmpStatus t) throws Exception {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public EmpStatus getById(Integer id) throws Exception {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    
    
}
